using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FPISystem.SQL;

namespace FPISystem.Forms
{
    public partial class UserHistory : FPISystem.BaseForms.InfoForm
    {
        public UserHistory()
        {
            InitializeComponent();
           
        }

        private void UserHistory_Load(object sender, EventArgs e)
        {
            Initial();
        }

        private bool Initial()
        {
            mydataGridView.Click += new EventHandler(mydataGridView_Click);
            ShowInfo();
            return true;
        }

        private void ShowCaseHist(DataGridViewRow row)
        {
            string userid = row.Cells[0].Value.ToString();
            if (userid.Trim()!="")
            {                
                txt_intime.Text = row.Cells[2].Value.ToString();
                txt_outtime.Text =row.Cells[3].Value.ToString();
                txt_Doct.Text=row.Cells[4].Value.ToString();
                txt_sickness.Text = row.Cells[5].Value.ToString();
                rtb_detail.Text = row.Cells[6].Value.ToString();
            }
        }

        void mydataGridView_Click(object sender, EventArgs e)
        {
            if (CurrentRow == null)
                return;
            ShowCaseHist(CurrentRow);
        }

        private void btn_OK_Click(object sender, EventArgs e)
        {

        }

        private void ShowInfo()
        {
            DataSet ds = StoredProcedure.SelectCaseHistory(User);
            if (ds != null)
            {
                SetDataGridView(ds);
            }
        }

    }
}

